<!DOCTYPE html>
<html>
<head>
  {include file="top.tpl"}
  <link rel="stylesheet" href="{$css.url}purchasing_require.css">
</head>
<body class="skin-blue">
<div class="wrapper">
	<!--引入面包屑-->
  	{include file="bread_crumbs.tpl"}
  	<!-- main start-->
  	<section class="detection-wrap">
		<div class="row">
			<div class="col-md-12">
				<div class="box">
					<div class="nav-tabs-custom">
						<ul class="nav nav-tabs">
					      <li><a href="/backup/log/a-story">需求A检测</a></li>
					      <li class="active"><a href="/backup/log/c-story">需求c检测</a></li>					      
					    </ul>
				    </div>
				    <div class="box-header with-border clearfix">
				    	<div class="row">
				    		<div class="col-sm-12">
				    			<div class="box-form pull-right form-group-sm">
			                		<p class="pull-right"><a href="javascript:;" class="btn btn-success btn-sm" id="js_toggleSearchBox"><i class="fa fa-search"></i><span class="pl5">搜索选项</span></a></p>
			                	</div>
				    		</div>
				    	</div>
				    	<div class="search-box" id="js_searchBox">
			    			<form action="" method="get" class="form-inline auto-restore">
				    			<div class="form-group">
					    			<label class="control-label">产品编码<span class="c_red">*</span> :</label>
					    			<input type="text" class="form-control" name="goods_sn">
					    		</div>
					    		<div class="form-group">
					    			<label class="control-label">所属事业部 <span class="c_red">*</span>:</label>
									<select class="form-control" name="dept_id" id="dept_id">
					    				<option value="">选择事业部</option>
                                         {foreach from=$hasWarehouseDep item=oneDep}
                                           <option value="{$oneDep['id']}">{$oneDep['department_name']}</option>
                                         {/foreach}
					    			</select>
					    		</div>
					    		<div class="form-group">
					    			<select name="warehouse" class="form-control" id="dep_warehouse" name="warehouse" style="width:200px;">
					    				<option value="">选择仓库</option>
					    			</select>
								</div>
								<div class="form-group">
								   <label class="control-label">日期 :</label>
								    <input type="text" class="form-control js_datePicker date_start" name="date" value="" placeholder="开始时间">
								</div>
								<div class="form-group">
					            	<input type="submit" id="search_button" class="btn btn-primary btn-sm" value="查询并检测">
								</div>
								<span class="pull-right"><a href="javascript:;">采购需求答疑文档下载</a></span>
							</form>
				    	</div>
				    </div>
				    <div class="box-body">
				    	<div class="well">
				    	<div class="row">
				    		<div class="col-sm-6">
			    				<p><span>产品名称：</span>{$productCStoryLog['product_name']|default:''} </p>
			    				<p><span>产品图片：</span><img src="{$productCStoryLog['thumb_url']|default:''}" alt=""></p>
			    				{if $productCStoryLog}
			    				<div class="log_detail">

				    				<p><span>需求C数量：</span>{$productCStoryLog['after_backup_amount_c_story_quantity']}</p>
				    				<p>
				    					<span>需求C计算日志如下（日志默认为当天的日志）：</span>
				    					<ul class="list-group list-wrap">
										  <li class="list-group-item">备货规则：{if ($productCStoryLog['backupRuleName']|default:'')} 
										  <a href="/backup/rule/view/?ruleId={$productCStoryLog['c_story_use_rule_id']}" class="ml10">查看详情</a>{/if}</li>
										  <li class="list-group-item">平均销售计算公式：{$productCStoryLog['meanSalesFormulaDescription']|default:''}</li>
										  <li class="list-group-item">计算得到的平均销量：{$productCStoryLog['mean_sales']}</li>
										  <li class="list-group-item">计算得到的备货数量：{$productCStoryLog['c_story_backup_init_quantity']}</li>
										  <li class="list-group-item">安全库存：{$productCStoryLog['safe_stock']}</li>
										  <li class="list-group-item">库存数量：{$productCStoryLog['stock']}</li>
										  <li class="list-group-item">最小备货量：{$productCStoryLog['c_story_min_quantity']}</li>
										  <li class="list-group-item">最大备货量：{$productCStoryLog['c_story_max_quantity']}</li>
										  <li class="list-group-item">最小起订量：{$productCStoryLog['product_min_order']} </li>
										  <li class="list-group-item">整箱数限制数量：{$productCStoryLog['product_package_quantity']}</li>
										  <li class="list-group-item">产品备货总量限制数量：{$productCStoryLog['product_backup_amount']}</li>
										</ul>
				    				</p>
				    				<p><span>检测结果：</span>{$productCStoryLog['c_story_check_description']}</p>
				    		   </div>
				    		   {/if}
				    		</div>
				    		{if $productCStoryLog}
				    		<div class="col-sm-6">
				    				<dl>
				    					<dt class="mb10">需求拦截规则</dt>
				    					<dd>1、若sku的销售仓库（在产品列表中）是分销前海保税仓，若在前海保税仓、香港仓、分销退税仓，则可正常产生需求；若在其他仓库产生需求，则将需求拦截。</dd>
				    					<dd>2、若sku的销售仓库是电子仓，若在分销前海保税仓、前海保税仓、香港仓、分销退税仓四个仓库产生需求，则将需求拦截；若在其他仓库，则可正常产生需求。</dd>
				    				</dl>
				    				<p class="mt50">
				    					<span>需求C检测过程如下：</span>
				    					<ul class="list-group">
											<li class="list-group-item">是否满足备货规则：
												 {if $productCStoryLog['c_story_backup_init_quantity']}
												   是
	                                             {else}
												   否
	                                             {/if}
											</li>
											<li class="list-group-item">是否被拦截：
												{if $productCStoryLog['c_story_is_intercept']}
												   是
	                                            {else}
												   否
	                                             {/if}
											</li>
											<li class="list-group-item">是否为清仓状态：
												{if $productCStoryLog['is_clearance']}
													是
		                                         {else}
													否
		                                         {/if}
											</li>
											<li class="list-group-item">是否有A需求：
											  	 {if $productCStoryLog['a_story_quantity']}
													是
		                                         {else}
													否
		                                         {/if}
		                                         需求c数量:{$productCStoryLog['after_a_story_limit_c_story_quantity']}
											 </li>
											<li class="list-group-item">是否低于最小备货量：
											   	 {if $productCStoryLog['less_than_story_min_quantity']|default:false}
													是
		                                         {else}
													否
		                                         {/if} 
										    	需求c数量:{$productCStoryLog['after_min_limit_c_story_quantity']}
											 </li>
											<li class="list-group-item">是否高于最大备货量：
												 {if $productCStoryLog['greater_than_story_max_quantity']|default:false}
													是
		                                         {else}
													否
		                                         {/if}
											    需求c数量:{$productCStoryLog['after_max_limit_c_story_quantity']}
											 </li>
											<li class="list-group-item">是否低于最小起订量：	 
											     {if $productCStoryLog['less_than_min_order']|default:false}
													是
		                                         {else}
													否
		                                         {/if}
		                                         需求c数量:{$productCStoryLog['after_min_order_limit_c_story_quantity']}
											</li>
											<li class="list-group-item">
											  	<div>
											  		<p>是否有”整箱“数量限制：
	 	                                             {if $productCStoryLog['product_package_quantity']}
														是
			                                         {else}
														否
			                                         {/if}
			                                         <p class="ml20">备货数量除以整箱数的余数：{$productCStoryLog['packageNumRemainder']|default:''}</p>
											  		 <p class="ml50">需求c数量:{$productCStoryLog['after_package_quantity_c_story_quantity']}</p>
											  		 </p>
											 
											  	</div>
											</li>
											<li class="list-group-item">是否高于最大备货量：
											 	 {if $productCStoryLog['greater_than_product_backup_amount']}
													是
		                                         {else}
													否
		                                         {/if}
		                                         需求c数量:{$productCStoryLog['after_backup_amount_c_story_quantity']}
											</li>
										</ul>
				    				</p>
				    		</div>
				    		{/if}
				    	</div>
				    </div>
				</div>
			</div>
		</div>
	</section>
  	<!-- main end-->
 </div>
{include file='foot.tpl'}
<script type="text/javascript">
 {literal}
$('#dept_id').change(dept);
function dept(did){
	var did = !isNaN(did) ? did : $(this).find('option:selected').val();
	var str = '<option value="0">选择仓库</option>';
	var select_warehouse=GLOBAL.getUrlParam('warehouse');
	$.ajax({
		url : '/base/warehouse/getselectedwarehousebydeptid',
		data : {did : did},
		dataType : 'json',
		type : 'get',
		success : function (result){
			$.each(result, function(i, n){
                if(select_warehouse && select_warehouse==n.warehouse_code){
                		str += '<option value="' + n.warehouse_code + '" selected>' + n.warehouse_name + '</option>' + "\r\n";
                	}else{
                		str += '<option value="' + n.warehouse_code + '">' + n.warehouse_name + '</option>' + "\r\n";
                }
			
			});
			$('#dep_warehouse').html(str);
			$("#dep_warehouse").select2();
		}
	});
}

$(function(){
    $('.date_start').datetimepicker({
	    format: "yyyy-mm-dd",
        minView:2,
        autoclose: true,
        todayHighlight: false
	});
})
{/literal}
dept(GLOBAL.getUrlParam('dept_id'));
</script>
<script src="{$js.url}form_helper.js"></script>
</body>
</html>